package com.itheima.controller;


import com.itheima.model.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    @Qualifier("userService")
    public UserService userService;
    @RequestMapping("/find_all")
    @ResponseBody
    @CrossOrigin(origins = "*")
    public List<User> find_all_users(){
        List<User> users = userService.find_all();
        return users;
    }

}
